<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>EOS.IO: Math C++ API</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="eos-logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">EOS.IO
   &#160;<span id="projectnumber">DAWN3.0.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">Modules</a> &#124;
<a href="#nested-classes">Classes</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Math C++ API<div class="ingroups"><a class="el" href="group__contractdev.html">Smart Contract API Reference</a> &raquo; <a class="el" href="group__mathapi.html">Math API</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Defines common math functions and helper types.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
Modules</h2></td></tr>
<tr class="memitem:group__fixedpoint"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fixedpoint.html">Fixed Point</a></td></tr>
<tr class="memdesc:group__fixedpoint"><td class="mdescLeft">&#160;</td><td class="mdescRight">32,64,128,256 bits version of Fixed Point variables <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__real"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__real.html">Real number</a></td></tr>
<tr class="memdesc:group__real"><td class="mdescLeft">&#160;</td><td class="mdescRight">Real number data type with basic operators. Wrap double class of Math C API. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structeosio_1_1uint128.html">eosio::uint128</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A struct that wraps <a class="el" href="structeosio_1_1uint128.html" title="A struct that wraps uint128 integer and defines common operator overloads. ">uint128</a> integer and defines common operator overloads.  <a href="structeosio_1_1uint128.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga51c4c1656f6c55e261e6ab5fd7397443"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mathcppapi.html#ga51c4c1656f6c55e261e6ab5fd7397443">eosio::multeq</a> (<a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;self, const <a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;other)</td></tr>
<tr class="memdesc:ga51c4c1656f6c55e261e6ab5fd7397443"><td class="mdescLeft">&#160;</td><td class="mdescRight">wraps multeq_i128 from <a class="el" href="group__mathcapi.html">Math C API</a>  <a href="group__mathcppapi.html#ga51c4c1656f6c55e261e6ab5fd7397443">More...</a><br /></td></tr>
<tr class="separator:ga51c4c1656f6c55e261e6ab5fd7397443"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4ef8c3f00b1ced637f145883f942b8ff"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mathcppapi.html#ga4ef8c3f00b1ced637f145883f942b8ff">eosio::diveq</a> (<a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;self, const <a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;other)</td></tr>
<tr class="memdesc:ga4ef8c3f00b1ced637f145883f942b8ff"><td class="mdescLeft">&#160;</td><td class="mdescRight">wraps diveq_i128 from <a class="el" href="group__mathcapi.html">Math C API</a>  <a href="group__mathcppapi.html#ga4ef8c3f00b1ced637f145883f942b8ff">More...</a><br /></td></tr>
<tr class="separator:ga4ef8c3f00b1ced637f145883f942b8ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac459e1d6c24d9178441fed9163accc79"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:gac459e1d6c24d9178441fed9163accc79"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__mathcppapi.html#gac459e1d6c24d9178441fed9163accc79">eosio::min</a> (const T &amp;a, const T &amp;b)</td></tr>
<tr class="memdesc:gac459e1d6c24d9178441fed9163accc79"><td class="mdescLeft">&#160;</td><td class="mdescRight">Defined similar to <a class="el" href="group__mathcppapi.html#gac459e1d6c24d9178441fed9163accc79" title="Defined similar to std::min() ">std::min()</a>  <a href="group__mathcppapi.html#gac459e1d6c24d9178441fed9163accc79">More...</a><br /></td></tr>
<tr class="separator:gac459e1d6c24d9178441fed9163accc79"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga29bcc1fa0b9eaa7667a68a2e135dd8bd"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:ga29bcc1fa0b9eaa7667a68a2e135dd8bd"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__mathcppapi.html#ga29bcc1fa0b9eaa7667a68a2e135dd8bd">eosio::max</a> (const T &amp;a, const T &amp;b)</td></tr>
<tr class="memdesc:ga29bcc1fa0b9eaa7667a68a2e135dd8bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define similar to <a class="el" href="group__mathcppapi.html#ga29bcc1fa0b9eaa7667a68a2e135dd8bd" title="Define similar to std::max() ">std::max()</a>  <a href="group__mathcppapi.html#ga29bcc1fa0b9eaa7667a68a2e135dd8bd">More...</a><br /></td></tr>
<tr class="separator:ga29bcc1fa0b9eaa7667a68a2e135dd8bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga4ef8c3f00b1ced637f145883f942b8ff"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4ef8c3f00b1ced637f145883f942b8ff">&#9670;&nbsp;</a></span>diveq()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void eosio::diveq </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;&#160;</td>
          <td class="paramname"><em>other</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Divide two 128 bit unsigned integers and assign the value to the first parameter. It will throw an exception if other is zero. This wraps diveq_i128 from <a class="el" href="group__mathcapi.html">Math C API</a> </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>Numerator. It will be replaced with the result </td></tr>
    <tr><td class="paramname">other</td><td>Denominator</td></tr>
  </table>
  </dd>
</dl>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> <span class="keyword">self</span>(100);</div><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> other(100);</div><div class="line"><a class="code" href="group__mathcppapi.html#ga4ef8c3f00b1ced637f145883f942b8ff">diveq</a>(<span class="keyword">self</span>, other);</div><div class="line">std::cout &lt;&lt; <span class="keyword">self</span>; <span class="comment">// Output: 1</span></div></div><!-- fragment --> 
</div>
</div>
<a id="ga29bcc1fa0b9eaa7667a68a2e135dd8bd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga29bcc1fa0b9eaa7667a68a2e135dd8bd">&#9670;&nbsp;</a></span>max()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">T eosio::max </td>
          <td>(</td>
          <td class="paramtype">const T &amp;&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const T &amp;&#160;</td>
          <td class="paramname"><em>b</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the greater of the given values. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">a</td><td>Value to compare </td></tr>
    <tr><td class="paramname">b</td><td>Value to compare </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The greater of a and b. If they are equivalent, returns a</dd></dl>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> a(1);</div><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> b(2);</div><div class="line">std::cout &lt;&lt; <a class="code" href="group__mathcppapi.html#ga29bcc1fa0b9eaa7667a68a2e135dd8bd">max</a>(a, b); <span class="comment">// Output: 2</span></div></div><!-- fragment --> 
</div>
</div>
<a id="gac459e1d6c24d9178441fed9163accc79"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac459e1d6c24d9178441fed9163accc79">&#9670;&nbsp;</a></span>min()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">T eosio::min </td>
          <td>(</td>
          <td class="paramtype">const T &amp;&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const T &amp;&#160;</td>
          <td class="paramname"><em>b</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the smaller of the given values </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">a</td><td>Value to compare </td></tr>
    <tr><td class="paramname">b</td><td>Value to compare </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The smaller of a and b. If they are equivalent, returns a</dd></dl>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> a(1);</div><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> b(2);</div><div class="line">std::cout &lt;&lt; <a class="code" href="group__mathcppapi.html#gac459e1d6c24d9178441fed9163accc79">min</a>(a, b); <span class="comment">// Output: 1</span></div></div><!-- fragment --> 
</div>
</div>
<a id="ga51c4c1656f6c55e261e6ab5fd7397443"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga51c4c1656f6c55e261e6ab5fd7397443">&#9670;&nbsp;</a></span>multeq()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void eosio::multeq </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;&#160;</td>
          <td class="paramname"><em>other</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Multiply two 128 bit unsigned integers and assign the value to the first parameter. This wraps multeq_i128 from <a class="el" href="group__mathcapi.html">Math C API</a>. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>Value to be multiplied. It will be replaced with the result </td></tr>
    <tr><td class="paramname">other</td><td>Value integer to be multiplied.</td></tr>
  </table>
  </dd>
</dl>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> <span class="keyword">self</span>(100);</div><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> other(100);</div><div class="line"><a class="code" href="group__mathcppapi.html#ga51c4c1656f6c55e261e6ab5fd7397443">multeq</a>(<span class="keyword">self</span>, other);</div><div class="line">std::cout &lt;&lt; <span class="keyword">self</span>; <span class="comment">// Output: 10000</span></div></div><!-- fragment --> 
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
